<div class="body-top">
	<div id="body-navigation">
		<div id="navcontainer-body">
			<ul class="navlist-body">
				<li class="active"><a href="./hallofcool.php">Hall of Cool Home</a></li>
				<li><a href="./fedimport.php">Federation Import</a></li>
				<li><a href="./leagueimport.php">League Import</a></li>
			</ul>
		</div>
	</div>
	<div class="hoc-form">
		<form action="{$action}" method="post" name="show">
			<div class="hoc-form-left">
				<div id="countries">
					<div class="select-title">Country:</div>
					<select name="select_countries" class="select-box" id="select_countries" onchange="showDivisions(this.value, 'hoc')">
						<option value="0">Any</option>
						{foreach from=$countries item=country name=countries_loop}
							<option value="{$country->getCountryID()}" {if $country->getCountryID() == $selected_country}selected="selected"{/if}>{$country->getName()}</option>
						{/foreach}
					</select>
				</div>
				{include file="hoc/select_divisions.tpl" divisions=$divisions selected_division=$selected_division leagues=$leagues selected_league=$selected_league}
				<div>
					<div class="select-title">In term of:</div>
					<select name="select_terms" class="select-box">
						<option value="1" {if 1 == $selected_term}selected="selected"{/if}>Coolness</option>
						<option value="2" {if 2 == $selected_term}selected="selected"{/if}>Flags</option>
					</select>
				</div>
			</div>
			<div class="hoc-form-right">
				<div>
					<div class="select-title">Federation:</div>
					<select name="select_alliances" class="select-box">
						<option value="0">Any</option>
						{foreach from=$alliances item=alliance name=alliances_loop}
							<option value="{$alliance->getAllianceID()}" {if $alliance->getAllianceID() == $selected_alliance}selected="selected"{/if}>{$alliance->getName()}</option>
						{/foreach}
					</select>
				</div>
				<div id="months">
					<div class="select-title">Startdate:</div>
					<select name="select_months" class="select-box" onchange="showYears(this.value, document.getElementById('select_years').value)">
					{foreach from=$months key=k item=v}
						<option value="{$k}" {if $k == $selected_month}selected="selected"{/if}>{$v}</option>
					{/foreach}
					</select>
				</div>
				{include file="hoc/select_years.tpl" years=$years selected_year=$selected_year}
				<div>
					<div class="select-title">Type:</div>
					<select name="select_types" class="select-box">
						<option value="1" {if 1 == $selected_type}selected="selected"{/if}>visited</option>
						<option value="2" {if 2 == $selected_type}selected="selected"{/if}>hosted</option>
						<option value="3" {if 3 == $selected_type}selected="selected"{/if}>visited AND hosted</option>
						<option value="4" {if 4 == $selected_type}selected="selected"{/if}>visited OR hosted</option>
						<option value="5" {if 5 == $selected_type}selected="selected"{/if}>visited PLUS hosted</option>
					</select>
				</div>
			</div>		
			<input name="hidden" type="hidden" value="show"></input>
			<input type="submit" class="show" value="Show"></input>
		</form>
	</div>
</div>
<div class="body-middle">
	{if $warning != null}<div class="warning-message"><p>{$warning}</p></div>{/if}
	{if $resultSize > 0}
	{if $resultSize > 100}
	<div class="paginate">{paginate_first text="&lt;&lt;"} {paginate_prev text="&lt;"} {paginate_middle format="page"} {paginate_next text=">"} {paginate_last text=">>"}</div>
	{/if}
	<table class="coolness">
		<tr>
			<th><b>#</b></th>
			<th><b>User</b></th>
			<th><b>Team</b></th>
			<th><b>Country</b></th>
			<th><b>League</b></th>
			<th {if $selected_term == 1}style="background-color:#6cac3f"{/if}><b>Coolness</b></th>
			<th {if $selected_term == 2}style="background-color:#6cac3f"{/if}><b>Flags</b></th>
			<th><b>Last update</b></th>
			{if $loggedIn == true}<th></th>{/if}
		</tr>
		
	{foreach from=$hocTable item=row name=hocTable_loop}
		{assign var=team value=$row->getTeam()}
		{assign var=country value=$row->getCountry()}
		{assign var=league value=$row->getLeague()}
		<tr {if $team->getTeamID() == $login_teamID}bgcolor="#9abeff"{/if}>
			<td align="right">{$row->getRank()}.</td>
			<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for this team">{$team->getUserName()}</a></td>
			<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for this team">{$team->getName()}</a></td>
			<td align="center"><a href="hallofcool.php?country={$country->getCountryID()}&amp;term={$selected_term}&amp;type={$selected_type}"><img class="flag" alt="{$country->getName()}" title="Show the ranking for this country" src="./flags/{$country->getCountryID()}_mini.gif"/></a></td>
			<td align="center"><a href="hallofcool.php?league={$league->getLeagueID()}&amp;term={$selected_term}&amp;type={$selected_type}"  title="Show the ranking for this league">{$league->getName()}</a></td>
			<td align="right">{$row->getCoolness()|number_format:2:".":" "}</td>
			<td align="right">{$row->getFlags()}</td>
			<td align="right" bgcolor="{$row->getColor()}">{$row->getUpdate()}</td>
			{if $loggedIn == true}
				{if $row->isUpToDate() == false}
			<td align="center" bgcolor="{$row->getColor()}">
				<form action="{$action}" method="post" name="update">
				<input name="hidden" type="hidden" value="update"></input>
				<input name="teamID" type="hidden" value="{$team->getTeamID()}"></input>
				<input type="submit" class="update" value="" alt="Update" title="Update this team now"></input>
				</form>
			</td>
			{else}
			<td align="center" bgcolor="{$row->getColor()}"><img src="./images/update_dis.png" alt="Update" title="This team was updated in the last 24 hours"></td>
			{/if}
			{/if}
		</tr>
	{/foreach}
	</table>
	{if $resultSize > 100}
	<div class="paginate">{paginate_first text="&lt;&lt;"} {paginate_prev text="&lt;"} {paginate_middle format="page"} {paginate_next text=">"} {paginate_last text=">>"}</div>
	{/if}
	<div class="directlink"><a class="read-more" href="{$directlink}">Direct link</a> to your selection.<br />Right click on the link - "Copy Link Location"</div>
	{else}<div class="warning-message"><p>No teams were found!</p></div>
	{/if}
</div>